#ifndef TRANSFORM_GEOMETRY_H
#define TRANSFORM_GEOMETRY_H

#include <glm/glm.hpp>
#include <vector>
#include "VertexArray.h"
#include "VertexBuffer.h"
#include "IndexBuffer.h"

class Geometry
{
protected:
	struct Vertex
	{
		glm::vec3 Position;	 // 顶点位置
		glm::vec2 TexCoords; // 纹理坐标
	};
	using Vertices = std::vector<Vertex>;
	using Indices = std::vector<unsigned int>;

public:
	void bind() const;
	void unbind() const;
	virtual ~Geometry();
	inline unsigned int count() const { return m_ib->count(); }

protected:
	void setup(const Vertices &v, const Indices &i);
	Geometry();

private:
	static VertexLayout Layout;
	VertexArray *m_va;
	VertexBuffer *m_vb;
	IndexBuffer *m_ib;
};

#endif // TRANSFORM_GEOMETRY_H
